home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / compdate.zip / COMPDATE.DOC next >
Text File  |  1993-05-01  |  7KB  |  149 lines

  1. COMPDATE Compare dates/times/sizes for two files; set errorlevel if different.
  2.          Copyright (c) 1993 Creativity in Action.  All rights reserved.
  3.  
  4. SUMMARY
  5. =======
  6. COMPDATE compares the dates, times and sizes of two files.  If all three
  7. match, the errorlevel flag is set to zero, otherwise it's set to some other
  8. number.  This flag can be checked in a batch file, detecting when a file has
  9. changed.  Network administrators can use it to insure that client support
  10. files match master files on the server.  By testing the errorlevel, the master
  11. files can be copied only if there's been a change.  If nothing has changed, no
  12. copies are made and thus the system runs much faster.
  13.  
  14.  
  15. SYNTAX
  16. ======
  17.     COMPDATE [/Help] [/Quiet] [d:][path]file1[.ext] [d:][path]file2[.ext]
  18.        or
  19.     COMPDATE [/Help] [/Quiet] [/All] @[d:][path]listfile[.ext]
  20.  
  21. Where:
  22.      [d:][path]file1[.ext] and
  23.      [d:][path]file2[.ext]     specify the files to be compared, including
  24.                                optional drive, path, and extension
  25.                                parameters, and
  26.     [d:][path]listfile[.ext]   specifies a list file containing a list of
  27.                                all the files to be compared.
  28.  
  29. Three switches are available:
  30.  
  31.     /H  Help.           Displays basic help information.
  32.     /Q  Quiet mode.     Do not display messages.  Useful in a batch file.
  33.     /A  AllFiles mode.  If using a list file, check every pair in the list
  34.                         for differences.  Normally COMPDATE will bail out
  35.                         after the first difference is detected.
  36.  
  37. By the way, we've tried to make this program as robust as possible.  If you 
  38. enter hyphens or backslashes instead of a forward slash, the switches will 
  39. still work.  We've also allowed for the help switch to be coded with /H (as is 
  40. common in DR-DOS), /? (as used in MS-DOS) and ? (as used by Norton Utilities).
  41.  
  42.  
  43. RETURN VALUES
  44. =============
  45. COMPDATE returns the following errorlevel codes
  46.  
  47.     errorlevel    meaning
  48.     ----------    -------
  49.     0             date/time/size identical
  50.     1             first file not found
  51.     2             second file not found
  52.     3             both files not found
  53.     4             dates are different
  54.     5             times are different
  55.     9             dates/times are both different
  56.     10            file sizes are different
  57.     14            file sizes and dates are different
  58.     15            file sizes and times are different
  59.     19            file sizes, dates, and times are all different
  60.     126           unable to open or read list file
  61.     127           help was requested; comparison not performed
  62.  
  63. USING A LIST FILE
  64. =================
  65. Sometimes you wish to compare several file pairs at a time.  If any one pair
  66. has a different size or date or time stamp, you want to perform some general
  67. operation.  Rather than write a batch file that runs COMPDATE several times,
  68. you can create a separate ASCII list file that contains all the pair names you
  69. wish to compare.  Since this must be an ASCII file, be sure to use an
  70. appropriate  ASCII editor.  DR-DOS's EDITOR.EXE, MS-DOS's EDIT.COM or
  71. EDLIN.COM, or XyQuest's XyWrite word processor are all useful.
  72.  
  73. This list file needs to contain two filenames on each line of text.  You can
  74. identify comment lines with an asterisk (*), ampersand (&) or semicolon (;) at
  75. the beginning of the line.  If COMPDATE encounters a comment line it will go
  76. on to the next line without performing the date/time comparison.
  77.  
  78. Here is a sample list file called MENU.LST:
  79.  
  80. ; this file compares network menu files with menu files on the user's drive
  81. ; if the files have different date or time stamps, a separate batch file will
  82. ; copy all these files from the n: drive to the u: drive
  83. n:\menusys\menusys.mnu        u:\menusys\menusys.mnu
  84. n:\menusys\menusys.mbt        u:\menusys\menusys.mbt
  85. n:\menusys\comm.mnu           u:\menusys\comm.mnu
  86. n:\menusys\comm.mbt           u:\menusys\comm.mbt
  87. n:\menusys\demos.mnu          u:\menusys\demos.mnu
  88. n:\menusys\demos.mbt          u:\menusys\demos.mbt
  89. n:\menusys\mgmt.mnu           u:\menusys\mgmt.mnu
  90. n:\menusys\mgmt.mbt           u:\menusys\mgmt.mbt
  91.  
  92.  
  93. EXAMPLE 1 - CHECKING A SINGLE FILE PAIR
  94. =======================================
  95. As a network administrator, you have added a utility called MY_UTIL.EXE to
  96. everyone's local hard disk C: in the \UTILITY directory.  A while later you
  97. improve the program.  You want to be sure that everyone has the latest
  98. version; if they don't, you want to copy it to their hard disks when they log
  99. on.  In a batch file that's run from a login script, you include the following
  100. lines:
  101.  
  102. COMPDATE n:\global\utility\my_util.exe c:\utility\my_util.exe /q
  103. if not errorlevel 1 goto util_current
  104.    copy n:\global\utility\my_util.exe c:\utility\my_util.exe > nul
  105. :util_current
  106.  
  107.  
  108. EXAMPLE 2 - CHECKING A LIST OF FILES
  109. ====================================
  110. You have defined a nested menu screen system for everyone in your group.
  111. Because of the way the software works, each user must have a personal copy
  112. installed on U:, their user drive.  Unfortunately, it's possible for the users
  113. to (inadvertently or not) modify their copy of the menu files.  Compounding
  114. the problem, numerous files are needed in order to run.  You want to insure
  115. that every user is running the same menu as defined by the master menu on
  116. network drive N:.  If any one file is missing or different, you want to recopy
  117. the whole set to the user's U: drive.
  118.  
  119. First you create the list file MENU.LST as illustrated earlier.  Then, in a
  120. batch file that's run from a login script, you include the following lines:
  121.  
  122. COMPDATE @n:\menusys\menu.lst /q
  123. if not errorlevel 1 goto menu_current
  124.    copy  n:\menusys\menusys.*  u:\menusys > nul
  125.    copy  n:\menusys\comm.*     u:\menusys > nul
  126.    copy  n:\menusys\demos.*    u:\menusys > nul
  127.    copy  n:\menusys\mgmt.*     u:\menusys > nul
  128. :menu_current
  129.  
  130. HISTORY
  131. =======
  132. Version 1.00   Initial release
  133. Version 1.10   Added test for file size, changed errorlevel values
  134.  
  135. SHAREWARE
  136. =========
  137. This program was written as shareware; your comments are welcome.  However, we
  138. reserve the copyright for the program.  If you find COMPDATE useful, send
  139. ten bucks to
  140.  
  141.      Creativity in Action, P. O. Box 6026, Fullerton, CA   92634-6026.
  142.  
  143. You're welcome--nay, encouraged--to distribute the program as long as you
  144. don't charge anything for it and don't change it in any way.  Be sure to
  145. include the documentation file when you distribute it.  You corporate guys--
  146. send a few extra bucks if you're going to use it all over the place.
  147.  
  148. Thanks for your support ....
  149.